package ua.vn.ticket_scanner.network.task.socket;

import org.json.JSONException;
import ua.vn.ticket_scanner.network.data.JSONKeys;
import ua.vn.ticket_scanner.network.task.socket.data.SocketInfo;
import ua.vn.ticket_scanner.user.UserData;


/**
 * Created by Ivan on 19.06.13.
 */
public class BlockValidatorsTask extends BaseTask {

    private static final String TAG = "BlockValidatorsTask";
    private final boolean isNeedToBlock;

    public BlockValidatorsTask(SocketInfo socketInfo, boolean isNeedToBlock) {
        super(socketInfo);
        this.isNeedToBlock = isNeedToBlock;
    }

    @Override
    public void makeJSON() {
        try {
            putJSON(JSONKeys.CMD, isNeedToBlock ? "blockValidators" : "unblockValidators");
            putJSON(JSONKeys.REQUEST_ID, "" + System.currentTimeMillis());
            putJSON(JSONKeys.SECRET_KEY, UserData.getInstance().getToken());
        } catch (JSONException e) {
            e.printStackTrace();
        }
    }
}
